﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Guest_room.BLL;

namespace GuestRoomMvc.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Result(string userid, string pwd, string userType)
        {

            string message = "";
            GuestRoomService guestRoomService = new GuestRoomService();
            if (userid == "" || pwd == "")
            {
                message = "请输入用户名或密码！";
            }
            else
            {
                bool isValidUser = guestRoomService.ValidateUser(userid, pwd, userType);

                if (isValidUser)
                {
                    message = "登录成功";                    
                }
                else
                {
                    message = "用户名或密码错误";
                }
            }
            ViewBag.Message = message;
            return View();
        }
    }
}